/**
  @file sm3.h
  @brief this file contains the declarations and documentation for SM3 algorithm.
  Function Declarations:
  - sm3(): Computes the SM3 digest of a given message.
**/

#ifndef SM_SM3_H
#define SM_SM3_H

#include "common.h"

/**
 * @brief Initializes the SM3 context for hashing.
 * This function prepares the internal state to begin a new SM3 hash operation.
 */
void sm3_init(u32 buf[8]);


/**
 * @brief Compresses a message block using the SM3 compression function.
 * @param msqblock A pointer to the message block that is to be compressed.
 * This function processes the given message block and updates the hash state accordingly.
 */
void sm3_compress(const u8 *msqblock, u32 buf[8]);


/**
 * @brief Computes the SM3 digest of a given message.
 * @param digest The output buffer where the computed hash will be stored.
 * It should be at least 32 bytes long to hold the SM3 digest.
 * @param msglen The length of the message to be hashed, measured in bits.
 * @param msg A pointer to the input message that is to be hashed.
 * This function performs the entire SM3 hashing process and stores the final digest.
 */
void sm3(u8 digest[32], u8 *msg, u64 message_len);


#endif //SM_SM3_H

